package com.cxl.autocode.data;

import org.apache.commons.lang.StringUtils;

import com.summer.core.entity.STable;

/**
 * 接口和实现不在一个包下面
 */
public class SmrDifPathImpl extends SmrFrame{
	
	public SmrDifPathImpl(STable bean) {
		super(bean);
		
	}
	
	/**
	 * 接口和实现不在一个包下面
	 */
	public void transformPath() {
		String pathArray[]=getBean().getClassName().split("\\.");
		int arraySize=pathArray.length;
		setDaoName(pathArray[arraySize-1]+"Dao");
		setDaoImplName(pathArray[arraySize-1]+"DaoImpl");
		setServiceName(pathArray[arraySize-1]+"Service");
		setServiceImplName(pathArray[arraySize-1]+"ServiceImpl");
		setActionName(pathArray[arraySize-1]+"Action");
		String path="";
		for(int i=0;i<arraySize;i++)
		{
			 path+=pathArray[i]+".";
			if(i==arraySize-3)
			{
				
				setDaoPackage(path+"dao");
				setServicePackage(path+"service");
				setActionPackage(path+"action"+(StringUtils.isNotEmpty(getBean().getPath())?("."+getBean().getPath().toLowerCase()):""));
				setServiceImplPackage(path+"service.impl");
				setDaoImplPackage(path+"dao.impl");
			}
		}
	}
}
